<template>
  <!-- <div class="dashboard-container">
    <component :is="currentRole" />
  </div> -->
  <div class="welcome-box">
    <p class="welcome">欢迎你，亲爱的{{name}}</p>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import adminDashboard from './admin'
import editorDashboard from './editor'

export default {
  name: 'Dashboard',
  components: { adminDashboard, editorDashboard },
  data() {
    return {
      currentRole: 'adminDashboard',
      name: '',
      jurisdiction: []
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  created() {
    this.name = JSON.parse(window.localStorage.getItem('jurisdiction')).user.name
    this.jurisdiction = JSON.parse(window.localStorage.getItem('jurisdiction')).accessList

    if (!this.roles.includes('admin')) {
      this.currentRole = 'editorDashboard'
    }
  }
}
</script>
<style lang="less" scoped>
.welcome-box {
  min-height: 200px;
  .welcome {
    margin-top:30px;
    text-align: center;
  }
}
</style>
